1 //+------------------------------------------------------------------+
2 //| Meta COT Movement Index.mq4 |
3 //| Copyright 2009, C-4 (Vasiliy Sokolov, Russia, St.-Petersburg,|
4 //| 2009), All Rights Reserved. |
6 //+------------------------------------------------------------------+
10 #property copyright "Copyright 2009, C-4 (Vasiliy Sokolov, SPb), All Rights Reserved."
11 #property link "vs-box@mail.ru"
13 #property indicator_separate_window
14 #property indicator_buffers 4
15 #property indicator_color1 Green
16 #property indicator_color2 Blue
17 #property indicator_color3 Red
18 #property indicator_color4 Silver
21 extern int movement_index=6;
22 extern bool Show_iNoncomm=false;
23 extern bool Show_iOperators=true;
24 extern bool Show_iNonrep=false;
25 extern bool Show_iOI=false;
27 double i_movement_noncomm[];
28 double i_movement_operators[];
29 double i_movement_nonrep[];
30 double i_movement_oi[];
36 if(init_data()==false)error=true;
37 if(error==false)load_data();
38 if(error==false)count_data();
44 if(error==true)Print(" . ");
45 if(DrawData==true)build_data();
50 SetIndexStyle(0,DRAW_HISTOGRAM);
51 SetIndexStyle(1,DRAW_HISTOGRAM);
52 SetIndexStyle(2,DRAW_HISTOGRAM);
53 SetIndexStyle(3,DRAW_HISTOGRAM);
55 SetIndexEmptyValue(0,EMPTY_VALUE);
56 SetIndexEmptyValue(1,EMPTY_VALUE);
57 SetIndexEmptyValue(2,EMPTY_VALUE);
58 SetIndexEmptyValue(3,EMPTY_VALUE);
59 SetLevelValue(0,-40.0);
61 SetLevelValue(2,40.0);
62 SetLevelStyle(0,0,Black);
63 if(load_cot_file==true)IndicatorShortName(StringConcatenate("Meta COT Movement Index (",period,";",movement_index,"): ",str_trim(cot_file)));
64 else IndicatorShortName(StringConcatenate("Meta COT Movement Index (",period,";",movement_index,"): ",name));
67 SetIndexBuffer(0,i_movement_oi);
68 SetIndexLabel(0,"Movement Index: Open Interest");
70 if(Show_iNoncomm==true){
71 SetIndexBuffer(1,i_movement_noncomm);
72 SetIndexLabel(1,"Movement Index: Noncommercial Traders");
74 if(Show_iOperators==true){
75 SetIndexBuffer(2,i_movement_operators);
76 SetIndexLabel(2,"Movement Index: Operators Traders");
78 if(Show_iNonrep==true){
79 SetIndexBuffer(3,i_movement_nonrep);
80 SetIndexLabel(3,"Movement Index: Nonrep Traders");
86 int end_data=get_lastdata();
87 for(int i=0;i<end_data;i++){
88 if(Show_iOI)i_movement_oi[i]=get_data(MOVEMENT_OI, i);
89 if(Show_iNoncomm){i_movement_noncomm[i]=get_data(MOVEMENT_NONCOMM, i);/*Print(get_data(OI_NET_NONCOMM, i));*/}
90 if(Show_iOperators)i_movement_operators[i]=get_data(MOVEMENT_OPERATORS, i);
91 if(Show_iNonrep)i_movement_nonrep[i]=get_data(MOVEMENT_NONREP,i);